<!DOCTYPE HTML>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="console/header">
</head>
<body>
<section class="content-header">
    <h1>科目凭证管理</h1>
    <small>列表管理</small>
</section>
<section class="content table-content">
    <table id="dataGrid"></table>
</section>
<div id="toolbar">
    <a href="/console/accountCertifcate/from" class="btn btn-primary" >添加科目凭证</a>
</div>
<div th:include="console/footer"></div>


<script type="text/javascript">
    $table = $("#dataGrid");
    $(function () {
        initDataGrid();
    });
    function initDataGrid(){
        $table.bootstrapTable({
            height : tableModel.getHeight(),
            idField : "id",
            columns: [[
                {title: "id", field: "id"},
                {title: "科目凭证名称", field: "accountName"},
                {title: "科目凭证代码", field: "accountCode"},
                {title: "科目类型", field: "type"},
                {title: "余额", field: "overage"},
                {title: "操作", field: "operate", align: 'center', events: operateEvents, formatter: operateFormatter}
            ]],
            url: '/console/accountCertifcate/list',
            queryParams: function(params){
                return params;
            },
            responseHandler : function (res) {
                return {
                    rows : res.result.pageInfo.list,
                    total : res.result.pageInfo.total
                }
            },
            sortName : 'id',
            sortOrder : 'asc',
            pagination : true,
            sidePagination : 'server',
            pageSize: 20,
            pageList : [20, 40, 50, 100],
            toolbar : "#toolbar",
            showRefresh : true,
            showToggle : true
        });
    }

    function operateFormatter(value, row, index) {
        return [
            '<a href="/console/accountCertifcate/from?id='+row.id+'" >',
            '<i class="glyphicon glyphicon-edit"></i>修改',
            '</a>  ',
            '<a class="remove" href="javascript:void(0);">',
            '<i class="glyphicon glyphicon-remove"></i>删除',
            '</a>'
        ].join('');
    }

    window.operateEvents = {
        'click .remove' : function (e, value, row, index) {
            operaModel.delRow(row.id, '/console/accountCertifcate/delete', 'id');
        }
    };

</script>
</body>
</html>

